home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 276-300 / disk_280 / graph / graph.doc < prev    next >
Text File  |  1992-05-06  |  30KB  |  730 lines

  1.  
  2.                   GRAPH, Version 1.00 - 4 August 1989
  3.  
  4.              Copyright 1989, David Gay. All Rights Reserved.
  5.              This software is freely redistrubatable.
  6.  
  7.    mail:
  8.  
  9.      David Gay
  10.      19 Chemin de la Source
  11.      1296 Coppet
  12.      Vaud
  13.      Switzerland
  14.  
  15.      From September 89 to June 1990
  16.      Somewhere in Pittsburgh :-)
  17.  
  18.    e-mail:
  19.      GAY_D@ELMA.EPFL.CH
  20.  
  21.  
  22.      From September 89 to June 1990
  23.      ???@???.cmu.edu
  24.  
  25.    Thanks to:
  26.  
  27.      Matt Dillon, for DME & DMouse
  28.  
  29.      Checkpoint Technologies <ckp@grebyn.com> (whoever that is ...), for
  30.         finding a bug that I've been chasing for far too long.
  31.  
  32.      Karl Lehenbauer for his tracking routines.
  33.  
  34.      The ARP project, for its file requester (I didn't quite feel like
  35.      writing one ...).
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.     CONTENTS
  47.  
  48.  
  49.     1) Introduction
  50.  
  51.     2) Operation
  52.        a) Basic Concepts
  53.        b) User Interface
  54.        c) A Quick Overview
  55.        d) Example
  56.  
  57.     3) Detailed description
  58.        a) Display
  59.        b) Expression Syntax
  60.        c) Menus
  61.  
  62.     4) Appendices
  63.        a) Function "Improvement"
  64.        b) Known bugs, Possible enhancements
  65.  
  66.  
  67.  
  68.  
  69.  
  70.     1) INTRODUCTION
  71.  
  72.     This program draws mathematical functions on a plane. Text & axes may
  73.     be added, and the result saved to disk or printed.
  74.  
  75.     All this is done through a fully Intuitionalised interface, with
  76.     multiple windows (for multiple graphs), requesters, etc. The whole
  77.     approach is WYSIWYG.
  78.  
  79.     This program requires the arp.library (for the file requester), and
  80.     WB 1.3 (or WB 1.2 if you don't want to print anything).
  81.  
  82.     This program should be fairly easy to use, I'm not sure how readable
  83.     this documentation is ! So, don't read it in isolation, experiment with
  84.     the program at the same time ...
  85.  
  86.  
  87.  
  88.  
  89.  
  90.     2) OPERATION
  91.  
  92.     a) Some basic concepts:
  93.  
  94.     - One POINT = 1/72th of an inch.
  95.  
  96.     - A GRAPH is composed of a SCALE (which selects which part of the plane
  97.       to view), optional X & Y AXES, and OBJECTS.
  98.  
  99.     - The SCALE defines the minimum and maximum values for the X & Y axes,
  100.       as well as if these are linear or logarithmic (in which case the
  101.       minimum must be greater than 0). Finally you can give a display ratio
  102.       (ie the size/unit of the Y axis / size/unit of the X axis. With 1, a
  103.       line y = x will appear "correct", that is at 45 degrees).
  104.  
  105.     - The (optional) drawing of AXES is specified through their position
  106.       on the other ax, the spacing between ticks, and the frequency with
  107.       which they should be numbered.
  108.       Note that the spacing between ticks is interpreted differently for
  109.       logarithmic axes. If x0 is the position of the Y ax on the (loga-
  110.       rithmic) X ax, and s is the tick spacing, you will get ticks at
  111.  
  112.         x0, x0+s, x0+2s, x0+3s, ..., 10*x0, 10*x0+s, ...
  113.  
  114.       For a linear ax, there is simply a tick every s, with a tick at x0.
  115.  
  116.     - OBJECTS can (in this version) only be FUNCTIONS and LABELS (Planned
  117.       extensions include lines & rectangles).
  118.  
  119.     - There are 4 types of FUNCTIONS:
  120.  
  121.         y = f(x)
  122.         x = x(t), y = y(t)
  123.         r = r(theta)
  124.         r = r(t), theta = theta(t)
  125.  
  126.       (the last two are in polar coordinates of course). A function
  127.       definition can contain VARIABLES (or if you prefer, constants :-)),
  128.       these are global.
  129.  
  130.     - LABELS can be multi-line, in any font, size or colour (more on this
  131.       later).
  132.  
  133.     - VARIABLES are defined globally to all graphs and functions, they
  134.       simply associate a name with an expression (which is evaluated when
  135.       the expression containing the variable is).
  136.  
  137.     Positions are generally specified in planar coordinates, and sizes in
  138.     inches (so as to provide device-independent output).
  139.  
  140.  
  141.     b) User interface
  142.  
  143.     The program is operated through a mix of menus, requesters, and mouse
  144.     clicking & dragging.
  145.  
  146.     When a menu option contains the characters "..." it means that there is
  147.     a requester associated with this command, a >> indicates a submenu.
  148.  
  149.     Most requesters contain OK and CANCEL gadgets, which act as expected.
  150.     You can use Left-Amiga V as a shortcut for clicking on OK, Left-Amiga B
  151.     for CANCEL, at *any* time. When entering text in a string gadget,
  152.     pressing RETURN will activate the next one, greatly simplyfing data
  153.     entry.
  154.  
  155.     Leaving a blank when a number is expected means to use the default
  156.     value, or not to display whatever is associated with this (if this
  157.     makes any sense).
  158.  
  159.     The two gadgets in the right hand border select the mode of operation
  160.     (see below).
  161.  
  162.     While a requester is present in one window, all operations are disabled
  163.     in other windows.
  164.  
  165.  
  166.     c) A Quick Overview
  167.  
  168.     A SCALE must be set before you can do most operations, this is done by
  169.     selecting the Scale menu option.
  170.  
  171.     Two modes exist, selected by the gadgets in the window:
  172.  
  173.       - Selection (Arrow gadget) : This mode allows you to select with the
  174.         mouse, and drag if applicable, objects on the graph.
  175.  
  176.       - Position (Crosshairs gadget) : You define a point (by clicking), or
  177.         a rectangle (by clicking and dragging) for further operations.
  178.  
  179.     You can add functions to the graph at any time (even before the scale
  180.     is set actually), to add a label you must have chosen the point where
  181.     it should appear. For a function, you must select a name for it and the
  182.     type you desire, you'll define the actual expression afterwards. For
  183.     text, you simply select the Add Label menu, and type the desired text.
  184.  
  185.     Before doing anything with an object, you must first select it. This
  186.     can be done in several ways:
  187.  
  188.       - By clicking on the object in select mode.
  189.  
  190.       - Functions, which may not always be displayed, can be selected by
  191.         name (Select Function, in the Edit menu).
  192.  
  193.       - A function is selected after it has been added(created).
  194.  
  195.     (there is also a deselect operation).
  196.  
  197.     The selected object can now be edited, deleted or improved (see
  198.     detailed description).
  199.  
  200.     Edition for a function means defining the expression used, and the
  201.     boundaries for the parameter (eg x=3*cos(t), y=5*sin(t), with
  202.     0<=t<=6.3), for a label you can select the font, the colour and the
  203.     size (given in points) (see detailed description for the problems
  204.     involved here), change the text that you initially entered, its
  205.     position, its justification with respect to this. Also, you make the
  206.     text appear at an offset in inches from the given coordinates, for
  207.     example to make text appear at a constant distance above the axis
  208.     irrespective of the size of the output sheet.
  209.  
  210.     The expressions for functions can contain VARIABLES (as noted above).
  211.     These are entered through the Edit Variables requester which works as
  212.     follows:
  213.  
  214.         i) Enter the variable to be added/edited/deleted in the Variables
  215.            gadget and PRESS RETURN (if you don't do this, it won't work),
  216.            or select the variable in the list displayed.
  217.  
  218.         ii) If the variable already exists, its value is displayed in the
  219.             Value gadget, which is activated.
  220.  
  221.         iii) You can delete the variable by clicking on the delete gadget,
  222.  
  223.         iv) Or, edit/add the value (which can be any expression, just avoid
  224.             circular definitions!). When this is done, PRESS RETURN
  225.             (otherwise the new value will be ignored). Syntax errors will
  226.             be indicated by a screen flash.
  227.  
  228.     Don't forget that these variables are global, and shared by all graphs.
  229.     As such, they are saved/loaded separately to/from disk (with the
  230.     Load/Save Variables command).
  231.  
  232.  
  233.     AXES are added with the Axes menu option.
  234.  
  235.  
  236.     You can easily change the part of the plane you are viewing with the
  237.     Zoom/Zoom Out/Center options:
  238.  
  239.       - Zoom: You first select a rectangle (in position mode), then choose
  240.         this option. The graph will be redrawn zoomed in this rectangle.
  241.  
  242.       - Zoom Out: The plane area covered is made 4 times bigger (this isn't
  243.         really true if one or both axes is logarithmic).
  244.  
  245.       - Center: The point selected becomes the new graph centre, the limits
  246.         are adjusted accordingly.
  247.  
  248.  
  249.     Graphs can be saved/loaded(this creates a new graph), and new graphs
  250.     created.
  251.  
  252.     Finally, you can preserve your efforts for posterity with the Output
  253.     Graph submenu, either to your favourite printer or as an ILBM file. In
  254.     the latter case, you must specify the resolution you desire, as well as
  255.     the number of pixels per inch (to allow the sizes you specify in inches
  256.     to be calculated). You might specify 2400 by 3300, at 300 dpi if you
  257.     later plan to send the output to a laser printer (sizes of up to 32767
  258.     x 32767 should be possible). Note that with this option, the graph will
  259.     be full page, the Ratio specified in the SCALE is ignored. This isn't
  260.     necessarily the case with printer output, where the indications given
  261.     in.Preferences will be followed as far as makes sense.
  262.  
  263.     You must then decide whether to have the functions drawn in a "thin"
  264.     pen (one pixel wide), or with a width of x points where you choose x.
  265.     Finally, your masterpiece will be printed/saved. As this can be a time
  266.     consuming process, you are given the possibility to abort it.
  267.  
  268.  
  269.     d) Example
  270.  
  271.     We want to create a graph of the functions y = x, and y = e^(-x*x),
  272.     label it, and print the result. We proceed as follows:
  273.  
  274.       i) run graph ; this helps :-)
  275.  
  276.       ii) First we select a scale, x from -3 to 3, y from -0.1 to 1 is
  277.           reasonable, so:
  278.           Select menu option Scale (shortcut Amiga-L), and enter these
  279.           values for X: Min & Max, Y: Min & Max. One could also set the
  280.           ratio to 2. Click on OK, or press Right-Amiga V.
  281.  
  282.       iii) We want the X & Y axes intersecting at (0,0) of course, you can
  283.            place ticks and numbering as you desire (eg a tick every 0.5 on
  284.            X, with values every two ticks). Press Amiga-X, and enter the
  285.            chosen values.
  286.  
  287.       iv) It's now time to add the two functions, first y = x:
  288.           Press Amiga-F, and enter name "x" for the function, click on OK
  289.           (the default type, f(x), is the one we want). The function has
  290.           now been created, but we must still define it: Select Edit in the
  291.           Edit menu, this will edit the currently selected object (ie the
  292.           function we just created). If you've done something inbetween,
  293.           you can reselect the function in the Select Function option
  294.           (under the Edit menu), and then Edit. Define the function as
  295.           being f(x)=x, you can leave the "from" and "to" gadgets blank,
  296.           the limits of the x axis will be used.
  297.  
  298.           y = exp(-x*x) : Add Function (giving it name exp), Edit it, and
  299.           define it as f(x)=exp(-sqr(x)) (don't forget that you must enter
  300.           the name of the independent variable, ie x).
  301.  
  302.           The two functions should have been drawn as soon as you finished
  303.           editing them, if this wasn't the case, you probably made an error
  304.           (of which you should have been informed).
  305.  
  306.       v) The graph is now complete, but you might want to label it a bit:
  307.          Add an "X" next to the X axis, a "Y" next to the Y axis, and a
  308.          title to the whole thing. Check that you are in "position" mode
  309.          before proceeding.
  310.  
  311.          Labels on the axes: Click *on* the ax which you want to label, and
  312.          select Add Label, and type the text desired (ie "X" or "Y"). The
  313.          label will be drawn, rather unesthetically on the ax. Now pass
  314.          into "select" mode, and click on your label, it should be high-
  315.          lighted. Select Edit, and change the Y and dY fields (for the X
  316.          axis label): Set Y to 0, and dY to 0.1. This means that the label
  317.          will be drawn 0.1 inches *below* the Y ax. You could also change
  318.          the font, the font size (in points), etc
  319.  
  320.          Title: In "position" mode, click wherever you want the title,
  321.          select Add Label and type the title. If you type a \, a line break
  322.          will be added at that place (two \\ are replaced by a single \),
  323.          so "Intersection of\two functions" would take two lines. As with
  324.          the labels on the axes, you can edit this label for font size and
  325.          so on.
  326.  
  327.       vi) It is now time to save & print the graph. Save Graph will
  328.           accomplish the former, Output Graph / To Printer the latter. You
  329.           will be asked to select the line thickness, then printing will
  330.           start. You can press the Stop! gadget at any time if you get
  331.           bored (or want to abort the printing).
  332.  
  333.       vii) You may want to change one of the functions, for example replace
  334.            y = x by y = a*x. Try the following:
  335.  
  336.            - Select the function, either by clicking on it (in "select"
  337.              mode), or with Select Function in the Edit menu.
  338.  
  339.            - Edit it, replacing f(x)=x by f(x)=a*x
  340.  
  341.            - Select OK
  342.  
  343.            The function will not be visible any more, because a has no
  344.            value.
  345.  
  346.       viii) So, we must give "a" a value. Select Edit Variables (Amiga-V),
  347.             enter a in the Variables gadget, PRESS RETURN (!), enter the
  348.             value 0.5, PRESS RETURN (!!!). "a" should appear in the
  349.             variable list above. Select OK, and the line should be redrawn.
  350.  
  351.       ix) That's it! (for now). You can close this graph with the close
  352.           gadget, or quit with the Quit option. You will be asked if you
  353.           want to save anything that has changed.
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.     3) DETAILED DESCRIPTION
  362.  
  363.     This section is more a reference than a tutorial, but should be read
  364.     carefully (all the details are here).
  365.  
  366.     a) Display (ie the window)
  367.  
  368.     The display is composed of a graph title, axes, and objects. It is a
  369.     view on a portion of the plane defined by the SCALE.
  370.  
  371.     The graph title displays the name (for functions) of the currently
  372.     selected object, and the position on the plane where you
  373.  
  374.       - currently are (while dragging something around)
  375.       - released the mouse button otherwise
  376.  
  377.     (in this context, the rectangle/cross-hairs of "position" mode is
  378.     considered to be an object).
  379.  
  380.     The axes are simply displayed as requested.
  381.  
  382.     Objects are of two types:
  383.  
  384.       - functions, which have a name, and are not always displayed.
  385.       - other objects (currently labels only) which are *always* visible.
  386.         If they are positioned outside the visible portion of the plane,
  387.         they are moved into it.
  388.  
  389.     They can be selected by clicking on them (or near them for functions),
  390.     the currently selected object is highlighted and is the one on which
  391.     all object commands operate. If the operation is meaningful, they can
  392.     be dragged or resized with the mouse.
  393.  
  394.     b) Expression syntax
  395.  
  396.     The following is an informal description of the syntax of expressions,
  397.     the actual priorities of the operators are the usual arithmetic ones
  398.     (with unary minus higher than power), they all group left to right.
  399.     | indicates alternatives, [] optional parts.
  400.  
  401.         expression := expression '+' expression |
  402.                       expression '-' expression |
  403.                       expression '*' expression |
  404.                       expression '/' expression |
  405.                       expression '^' expression |
  406.                       '+' expression |
  407.                       '-' expression |
  408.                       '(' expression ')' |
  409.                       number |
  410.                       function '(' expression ')' |
  411.                       variable
  412.  
  413.         number := mantissa [exponent]
  414.  
  415.         mantissa := integer [ '.' integer ]
  416.  
  417.         exponent := 'E' [sign] integer
  418.  
  419.         sign := '+' | '-'
  420.  
  421.         function := <see Appendix B>
  422.  
  423.         variable := <any name>
  424.  
  425.  
  426.     You will notice (?) that numbers do not allow a leading sign, negative
  427.     numbers are actually entered as an expression of the form -expression.
  428.  
  429.     The following functions are available:
  430.  
  431.         name        description
  432.         ----        -----------
  433.         sin         sine
  434.         cos         cosine
  435.         tan         tangent
  436.         asin        Arc sine
  437.         acos        Arc cosine
  438.         atan        Arc tangent
  439.         sinh        hyperbolic sine
  440.         cosh        hyperbolic cosine
  441.         tanh        hyperbolic tangent
  442.         asinh       inverse hyperbolic sine
  443.         acosh       inverse hyperbolic cosine
  444.         atanh       inverse hyperbolic tangent
  445.         exp         e^x
  446.         exp10       10^x
  447.         abs         absolute value - not differentiable
  448.         log         base e logarithm
  449.         log10       base 10 logarithm
  450.         sqrt        square root
  451.         sqr         x^2
  452.         gamma       gamma function - not differentiable
  453.  
  454.  
  455.     And these are the possible errors:
  456.  
  457.       - the syntax of an expression was incorrect
  458.       - no memory for requested operation
  459.       - parenthesises are not matched
  460.       - left parenthesis expected (after a function)
  461.       - you have asked for a recursive evaluation ...
  462.       - the result isn't a number (quick_eval)
  463.  
  464.     c) Menus
  465.  
  466.       This is detailed description of what the various menu options do.
  467.  
  468.       i) Project
  469.  
  470.          New Graph: This creates a new window in which you can enter
  471.          another graph. All windows are independent, but variables are
  472.          shared. Note also that while a requester is up in one window, you
  473.          can't use the others.
  474.  
  475.          Delete Graph: The current window is closed, this is equivalent to
  476.          the close window gadget. If this is the last window, the program
  477.          quits (see Quit). If the graph hasn't been saved, you are given a
  478.          last opportunity to do so (see Save Graph).
  479.  
  480.          Load Graph: You choose a file to load (with the ARP file reques-
  481.          ter), if the file is really a saved graph it is loaded, and a new
  482.          graph created from it.
  483.  
  484.          Save Graph: The graph in this window is saved to disk (you choose
  485.          a file with the ARP requester, again).
  486.  
  487.          Output Graph: This is a submenu, for producing "hard" output
  488.          either to disk or printer. Sizes in inches are preserved (as far
  489.          as possible, see individual object descriptions under Add), but
  490.          the SCALE is adapted to the area available.
  491.  
  492.          You must always choose a line thickness, either thin (1 pixel
  493.          wide), or in points (A requester appears just before output). You
  494.          can abort at any point by clicking on the Stop! gadget.
  495.  
  496.          All the output is in black and white, this should be changed.
  497.  
  498.             To Printer: The graph is sent to the printer, following the
  499.             indications in preferences as follows:
  500.  
  501.             - Aspect is always horizontal.
  502.             - Scaling is always Fraction.
  503.             - The graph is printed at the chosen density (I hope you like
  504.               the output!).
  505.             - The Limits are interpreted as follows:
  506.               Multiply is equivalent to Ignore
  507.               Ignore is equivalent to Bounded, with the size limited to one
  508.               page (the size of one page is determined by the Page Length
  509.               and the Spacing).
  510.               In Bounded if no ratio is given the full size is used, other-
  511.               wise the size is determined to give the correct ratio.
  512.               In Absolute or Pixels, the given size is used. If one limit
  513.               is unspecified (ie width or height = 0) the ratio is used to
  514.               adjust it.
  515.  
  516.             To Disk: A requester appears asking for the file name (you can
  517.             click on the Disk gadget to use the file requester), you must
  518.             give the size of the bitmap you want to produce, as well as its
  519.             resolution in dots per inch (to allow the size calculations to
  520.             be done). Once all this has been done, the graph is written as
  521.             an ILBM IFF file.
  522.  
  523.  
  524.          Load Variables: The variables are loaded from the specified file,
  525.          and are added to (or replace) the current ones.
  526.  
  527.          Save Variables: All the existing variables are saved to a file.
  528.  
  529.          Quit: All the graphs are closed (see Delete Graph). If the
  530.          variables have not been saved, Save Variables is called.
  531.  
  532.  
  533.       ii) Graph
  534.  
  535.           Scale: This brings up a requester allowing you to set/change the
  536.           SCALE. If you leave the ratio blank, none will be used (ie the
  537.           graph will fill the wholde window/page).
  538.  
  539.           Axes: Here you choose the options to display the AXES. If the
  540.           position of an ax is left blank none is displayed, if the tick
  541.           interval is blank no ticks are drawn, and if no frequency is
  542.           given no numbering is done.
  543.  
  544.           Zoom: After defining a rectangle in "position" mode you can zoom
  545.           in to it with this option.
  546.  
  547.           Zoom Out: The plane portion viewed is made "twice" as big,
  548.           keeping the same centre. The old visible portion now occupies
  549.           the centre of the new visible portion, and is half as wide (on
  550.           screen). If an ax is linear this is the expected effect: if
  551.           before we had -1<x<3, we get -3<x<5 (same centre (1), interval
  552.           twice as wide). However a logarithmic ax, 0.1<x<10 will become
  553.           0.01<x<100.
  554.  
  555.           Centre: The point selected becomes the new graph centre (but the
  556.           graph stays the same "size"). Expect strange (or normal?)
  557.           behaviour similar to that described in Zoom Out.
  558.  
  559.  
  560.       iii) Add
  561.  
  562.            Function: A new function is created, you must give it a unique
  563.            name, and select its type (which can not be changed afterwards).
  564.            Functions can not be dragged, they can be selected by clicking
  565.            on them when they are visible. The function is selected once you
  566.            have added it so that you can immediately define (edit) it.
  567.  
  568.            Label: A new label is created at the current point (which must
  569.            exist!), you enter the text in a requester. A \ signals a new
  570.            line, except if it is followd by a second one in which case a
  571.            single \ is displayed. The label is created in the default font
  572.            and size (topaz, 10 points).
  573.  
  574.            Labels are always visible, where they to be outside the shown
  575.            part of the plane they are moved just inside. They can be
  576.            selected and dragged around with the mouse.
  577.  
  578.            The size of a font is specified in POINTS so that it appears the
  579.            same on all output devices (ever seen Topaz 8 at 240 dpi?).
  580.            However as the standard Amiga fonts are used, and these are not
  581.            scalable, the nearest available size is used. This can easily
  582.            cause problems if you ask for too big a font, which might exist
  583.            in the correct size to appear correctly on screen, but not on
  584.            paper. Beware! (You can work out the size needed from the reso-
  585.            lution of your printer, a 10 point font on a 300 dpi requires a
  586.            300*(10/72) = 42 pixel font on the Amiga). Also, the horizontal
  587.            size may vary a bit on different output devices ...
  588.  
  589.  
  590.       iv) Edit
  591.  
  592.           Variables: The edit variables requester is brought up. It works
  593.           as follows:
  594.             - You select a variable by clicking in the list of existing
  595.               ones, or by typing its name in the Variables gadget and
  596.               PRESSING RETURN.
  597.             - Its value (if any) is then displayed. You can delete this
  598.               variable by clicking on the Delete gadget, or change its
  599.               value in the Value gadget. To store this value, you MUST
  600.               PRESS RETURN.
  601.             - When you are done, select OK.
  602.           Don't forget that the variables are global to all graphs.
  603.  
  604.           Select Function: A list of all variables is presented, you can
  605.           choose one of them which then becomes the selected object (This
  606.           is most useful when a function is not displayed).
  607.  
  608.           Deselect: Deselects the current selection.
  609.  
  610.           Edit: Edits the currently selected object. This is of course
  611.           different for every type of object ...
  612.  
  613.             Labels: You can change the text (max 255 characters), change
  614.             the font, font size and text colour. The position can be
  615.             entered exactly, and an offset in inches (dX & dY) can be
  616.             added. This allows for placement at a constant distance from
  617.             something else (object, ax) whatever the output device. Also
  618.             you can specify the justification of the rectangle containing
  619.             the text with respect to its position (by default, the chosen
  620.             point is in its top left corner).
  621.  
  622.             Functions: For all types, you must define the independent
  623.             variable (eg x, t, but could be anything) for this function,
  624.             followed by the actual expressions defining the function (see
  625.             Expression Syntax). You must then give the bounds for the
  626.             independent variable, these are obligatory except for functions
  627.             of type f(x) where the bounds of the graph are used when none
  628.             are given here (Note that this implies that the points for the
  629.             function are recalculated every time the bounds for the graph
  630.             are changed, which is not the case when they are given expli-
  631.             citly). The numbers of points you wish to be calculated must
  632.             also be given (default: 100), the more the better the function
  633.             will look but the longer it will take to calculate & display
  634.             them. The colour can be selected, for the meaning of the Show
  635.             discontinuities and Allow flat discontinuities options see
  636.             Appendix on Improve. If the data given is valid, the points
  637.             will be calculated and the function drawn.
  638.  
  639.             Improve: This command tries to improve the look of an object.
  640.             Currently this is only done for functions: extra points are
  641.             added if the program thinks this will make the function look
  642.             better. This requires some discussion ... (see Appendix). Note
  643.             that this improvement is temporary: If a graph is saved and
  644.             reloaded, if the function is changed (ie anything that necessi-
  645.             tates a recalculation of the points composing a function) will
  646.             discard the improvements made (Note that changing the bounds of
  647.             a graph will require the recalculation of functions of type
  648.             f(x) with unspecified bounds, as seen above).
  649.  
  650.             Delete: The selected object is deleted, the graph redrawn.
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.     4) APPENDICES
  658.  
  659.        a) Function "Improvement"
  660.  
  661.        When you draw a function like y = 1/x or y = sin(1/x) you encounter
  662.        various problems: discontinuities, lack of points to draw the func-
  663.        tion correctly. This function attemps to solve them by adding an
  664.        extra points between two points that are judged too far "apart". If
  665.        this process fails to solve the problem after a given number of
  666.        iterations (4) the program decides that there is a discontinuity
  667.        between the two points. This may well be incorrect (especially if
  668.        far too few points were initially calculated), so you can run
  669.        Improve repeatedly. This has the disadvantage that it may add a lot
  670.        of points.
  671.  
  672.        This is were the Show/Allow flat discontinuities options intervene. If
  673.        the Show disc. option is not selected, a segment will be drawn between
  674.        two consecutive even if the above procedure thinks that there is a
  675.        discontinuity. The Allow flat disc. option proved emprically necessary,
  676.        it indicates that flat segments (ie quasi horizontal or vertical) should
  677.      
  678.        be ignored in the search for discontinuities (otherwise one got severe
  679.        problems with functions like sin(x) around pi/2).
  680.  
  681.        How does one judge if two points are two far "apart" you wonder ?
  682.        Given two points x0, x1 (in the f(x) case), the value of f(x1) is
  683.        estimated by e = f(x0) + (x1 - x0) * f'(x0) (First order Taylor
  684.        approximation). If e - f(x1) is too big (if |e - f(x1)| > 0.2 *
  685.        |f(x1) - f(x0)|) an extra point is added. This of course requires
  686.        f'(x), which can easily be obtained from f(x). If that function
  687.        wasn't differentiable, you'll get an error message when you try to
  688.        use the Improve command. For other types of functions, the approach
  689.        is very similar.
  690.  
  691.        Finally, note that the above can be a time (and memory) consuming
  692.        process, so you can abort it at any time by clicking on the Stop!
  693.        gadget.
  694.  
  695.        Comments on the above from numerical analysts are not welcome :-)
  696.  
  697.  
  698.        b) Known bugs, Possible enhancements
  699.  
  700.         - The program was designed to recover from lack of memory (it makes
  701.           many, many allocations) but this feature has not been tested and
  702.           I'm pretty sure doesn't quite work.
  703.  
  704.         - The very many and small memory allocations made could easily
  705.           fragment memory extensively. Something should be done about this
  706.           (an allocation is done for every point of every function !).
  707.  
  708.         - More object types (lines, rectangles, circles, splines) could be
  709.           added.
  710.  
  711.         - Add AREXX interface (?)
  712.  
  713.         - Postscript output (I'll have to learn postscript first!)
  714.  
  715.         - Make variables local to graphs ?
  716.  
  717.         - Allow user to choose simple or smart refresh windows.
  718.  
  719.         - Colour printing.
  720.  
  721.         Very ambitious additions:
  722.  
  723.           - Add scalable fonts (Very big :-))
  724.  
  725.           - Add additional types of graphs, eg 3d, sampled (as in
  726.             histograms, that is with a non continous axis).
  727.  
  728.         - ...
  729.  
  730.